package com.etheart.framework.core.util;

import java.security.MessageDigest;

import sun.misc.BASE64Encoder;

public class MD5 {

	public static String md5(String source) {
		try {
			MessageDigest messageDigest = MessageDigest.getInstance("MD5");
			byte[] b = messageDigest.digest(source.getBytes("utf-8"));
			BASE64Encoder base64en = new BASE64Encoder();
			return base64en.encode(b);
		} catch (Exception e) {
			throw new RuntimeException("not support md5");
		} 
	}

	 public static void main(String[] args) {
		 String result = MD5.md5("admin");
		 System.out.println(result);
		 
	}


}
